package org.yang.novel.wx.controller;

import org.yang.common.Msg;
import org.yang.novel.wx.entity.User;
import org.yang.novel.wx.service.UserService;
import org.springframework.web.bind.annotation.*;

import com.github.pagehelper.PageInfo;

import javax.annotation.Resource;
/**
 * 用户控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/07
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    @GetMapping("/getUsers")
    public PageInfo getUsers(User user,Integer page,Integer limit){
        return userService.getUsers(user,page,limit);
    }
    @PostMapping("/addUser")
    public Msg addUser(User user){
        return userService.addUser(user);
    }

    @PutMapping("/updateUser")
    public Msg updateUser(User user){
        return userService.updateUser(user);
    }

    @DeleteMapping("/delUser")
    public Msg delUser(User user){
        return userService.delUser(user);
    }
}
